package com.jsyl.lwbk.business.mapper.education;

import com.jsyl.lwbk.business.domain.ReadingComprehensionPlan;
import com.jsyl.lwbk.business.domain.education.ChildCourseExample;
import com.jsyl.lwbk.business.domain.education.CourseChild;
import com.jsyl.lwbk.business.dto.ChildCourseDTO;
import com.jsyl.lwbk.business.dto.ChildInfoDTO;
import com.jsyl.lwbk.business.dto.NewChildInfoDTO;
import com.jsyl.lwbk.business.dto.education.ChildCourseListDTO;
import com.jsyl.lwbk.business.domain.education.ChildCourse;
import com.jsyl.lwbk.business.dto.ChildAgeDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface ChildCourseMapper {
    long countByExample(ChildCourseExample example);

    int deleteByExample(ChildCourseExample example);

    int deleteById(Long id);

    int insert(ChildCourse record);

    ChildCourse selectById(Long id);

    int insertSelective(ChildCourse record);

    List<ChildCourse> selectByExample(ChildCourseExample example);


    List<CourseChild> listGenPlanChild();

    List<ChildCourse> selectList(@Param("dayDate")String dayDate,
                                 @Param("centerId")String centerId,
                                 @Param("teacherName")String teacherName,
                                 @Param("teacherId")Long teacherId);

    List<ChildCourse> listReadingComprehension(@Param("dayDate")String dayDate,
                                 @Param("centerId")String centerId,
                                 @Param("teacherName")String teacherName,
                                 @Param("teacherId")Long teacherId);

    List<ChildCourse> listLearning(@Param("dayDate")String dayDate,
                                               @Param("centerId")String centerId,
                                               @Param("teacherName")String teacherName,
                                               @Param("teacherId")Long teacherId);

    List<ChildCourse> listSensory(@Param("dayDate")String dayDate,
                                               @Param("centerId")String centerId,
                                               @Param("teacherName")String teacherName,
                                               @Param("teacherId")Long teacherId);

    List<ChildCourse> listThinking(@Param("dayDate")String dayDate,
                                               @Param("centerId")String centerId,
                                               @Param("teacherName")String teacherName,
                                               @Param("teacherId")Long teacherId);
    List<ChildCourse> listSocialize(@Param("dayDate")String dayDate,
                                   @Param("centerId")String centerId,
                                   @Param("teacherName")String teacherName,
                                   @Param("teacherId")Long teacherId);

    List<ChildCourse> listEnrol(@Param("dayDate")String dayDate,
                                   @Param("centerId")String centerId,
                                   @Param("teacherName")String teacherName,
                                   @Param("teacherId")Long teacherId);

    List<ChildCourse> list(ChildCourseListDTO childCourseListDTO);

    int updateByExampleSelective(@Param("record") ChildCourse record, @Param("example") ChildCourseExample example);

    int updateByExample(@Param("record") ChildCourse record, @Param("example") ChildCourseExample example);

    ChildCourseDTO getCourseInfo(@Param("childCourseId") Long childCourseId);

    /**
     * 判断本节课是否已选择训练包
     * @param childCourseId
     * @return
     */
    ChildCourse hasCheckTrainPackage(@Param("childCourseId") Long childCourseId);

    int updateClassPlanId(@Param("childCourseId") Long childCourseId,
                          @Param("classPlanId") Long classPlanId);

    /**
     * 阅读理解：完成备课
     * @param id
     * @param classPlanId
     * @return
     */
    int savePlan(@Param("id") Long id,
                 @Param("classPlanId") Long classPlanId,
                 @Param("classTimes")Integer classTimes);

    /**
     * 融合课：确认计划
     * @param classId
     * @param classTimes
     * @param classPlanId
     * @return
     */
    int saveFusionPlan(@Param("classId") Long classId,
                       @Param("classTimes")Integer classTimes,
                 @Param("classPlanId") Long classPlanId);
    /**
     * 阅读理解：取消备课
     * @param id
     * @return
     */
    int cancelPlan(@Param("id") Long id);

    int updateClassPlanIdAndClassTimes(@Param("childCourseId") Long childCourseId,
                                       @Param("classPlanId") Long classPlanId,
                                       @Param("classTimes") Integer classTimes);

    int updatePrepareStatus(@Param("childCourseId") Long childCourseId,
                            @Param("prepareStatus") Integer prepareStatus);

    int updateClassTimes(@Param("childCourseId") Long childCourseId,
                            @Param("classTimes") Integer classTimes);
    int updateScoreFlag(@Param("childCourseId") Long childCourseId);

    /**
     * 取消备课
     * @param childCourseId
     * @return
     */
    int cancelPrepare(@Param("childCourseId") Long childCourseId);

    /**
     * 获取当前课程之后已备课课程数
     * @param childCourseId
     * @return
     */
    int countPreparedCourse(@Param("childCourseId") Long childCourseId);
    /**
     * 获取班级某天已备课课程数
     * @param
     * @return
     */
    int countPreparedClassId(@Param("classId") Long classId,@Param("dayDate") String dayDate);

    /**
     *
     * @param childCourseId
     * @return
     */
    ChildCourse getNoScore(@Param("childCourseId") Long childCourseId);
    /**
     *
     * @param childCourseId
     * @return
     */
    ChildCourse getNoScoreByPrepare(@Param("childCourseId") Long childCourseId);

    /**
     *
     * @param childCourseId
     * @return
     */
    ChildCourse getNoPrepare(@Param("childCourseId") Long childCourseId);

    List<NewChildInfoDTO> listNewChild(@Param("childCourseId") Long childCourseId,
                                       @Param("dayTime") String dayTime,
                                       @Param("classId")Long classId);


    List<ChildAgeDTO> listAge(@Param("childCourseId") Long childCourseId);
    /**
     *
     * @param childCourseId
     * @return
     */
    ChildCourse getAfterPrepare(@Param("childCourseId") Long childCourseId);

    /**
     *
     * @param childCourseId
     * @return
     */
    List<ChildCourse> getNoScoreChild(@Param("childCourseId") Long childCourseId,
                                @Param("dayDate") String dayDate,
                                      @Param("courseId") String courseId);

    /**
     * 取消备课时判断当天之前时间是否还有已备课未填写成绩课程
     * @param childCourseId
     * @return
     */
    ChildCourse getPrepareNoScore(@Param("childCourseId") Long childCourseId);

    /**
     * 获取该班级已备课课时
     * @return
     */
    ChildCourse getCompleteTimes(@Param("childCourseId") Long childCourseId);

    /**
     * 获取本班级上一节课主题ID及classTImes
     * @param classId
     * @return
     */
    ChildCourse getLastClassInfo(@Param("classId")Long classId);

    ReadingComprehensionPlan getClassPlanByClassTimes(@Param("classId")Long classId,
                                                      @Param("classTimes")Integer classTimes);

    void updateClassPlanIdById(@Param("id")Long id,
                                       @Param("classPlanId")Long classPlanId);

    List<ChildInfoDTO> listChildInfo(@Param("childCourseId") Long childCourseId);

    int delClassPlanId(@Param("classId") Long classId,@Param("dayTime") String dayTime);


    ChildCourse getLastClassScoreFlag(@Param("classId") Long classId,
                                      @Param("dayTime") String dayTime,
                                      @Param("dayDate") String dayDate);


    /**
     * 获取阅读理解课程已完成教案序号
     * @return
     */
    int getCompletePlan(@Param("classId") Long classId);

    /**
     * 获取融合课程已完成教案序号
     * @return
     */
    Integer getFusionScheduleCompletePlan(@Param("classId") Long classId);

    /**
     * 获取阅读理解未填写成绩的课程
     * @param classId
     * @return
     */
    ChildCourse getNoScoreSchedule(@Param("classId") Long classId);

    ChildCourse getFistCourseId(@Param("classId") Long classId,@Param("courseId") String courseId);
}